package com.wxy.controller;

import java.util.ArrayList;
import java.util.List;

import org.apache.ibatis.javassist.expr.NewArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wxy.domain.bank;
import com.wxy.domain.user;
import com.wxy.domain.user2;
import com.wxy.service.service;

import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;


@Controller
public class springBootController {
	@Autowired
	private service service;
	@Autowired
	private RedisTemplate<String,String> redisTemplate;
	@RequestMapping("/test1")
	@ResponseBody
	public String test1() {
		return "hello springBoot";
	}
	@RequestMapping("/test2")
//	@ResponseBody
	public String test2(Model model) {
		model.addAttribute("name", "张三");
		List<bank> banks=new ArrayList<bank>();
		banks.add(new bank(1,"1111","1111"));
		banks.add(new bank(2, "2222", "2222"));
		banks.add(new bank(3, "3333", "3333"));
		model.addAttribute("banks",banks);
		model.addAttribute("bank",new bank(4, "4444", "4444"));
		return "index";
	}
	@RequestMapping("/test3")
	@ResponseBody
	public void test3(HttpServletRequest request) {
		String username=request.getParameter("username");
		String password=request.getParameter("password");
		System.out.println(username+password);
	}
}
